<div id="edit_assignment_wrapper">
  {{#if frozen}}
    <div class="alert alert-info">
      <i class="icon-warning"></i> {{#t}}Some settings have been administratively locked.{{/t}}
    </div>
  {{/if}}
  {{#if inClosedGradingPeriod}}
    <div class="alert alert-info">
      <i class="icon-warning"></i> {{#t}}Some settings have been disabled because the assignment is in a closed grading period.{{/t}}
    </div>
  {{/if}}


  <div class="control-group">
    {{#if lockedItems.content}}
      <h1 id="assignment_name" class="title">{{name}}</h1>
      <input type="hidden" name="name" value="{{name}}"/>
    {{else}}
      <div>
        <label for="assignment_name" class="screenreader-only">{{#t}}Assignment Name{{/t}}</label>
        <input id="assignment_name"
          name="name"
          placeholder="{{#t "assignment_name"}}Assignment Name{{/t}}"
          value="{{name}}"
          type="text"
          maxlength="254"
          class="input-block-level"
          {{#if inClosedGradingPeriod}}
            readonly
          {{/if}}
          {{disabledIfIncludes frozenAttributes "title"}}
          autofocus/>
      </div>
    {{/if}}
  </div>

  {{#unless isQuizLTIAssignment}}
    <div class="control-group">
      {{#ifIncludes frozenAttributes "description"}}
        <div class="frozen-description user_content">
          {{convertApiUserContent description}}
        </div>
      {{else}}
        {{#if lockedItems.content}}
          <div id="assignment_description" class="assignment_description">
            {{convertApiUserContent description}}
          </div>
        {{else}}
          <div style="float: right;">
            <a href="#" class="rte_switch_views_link">
              {{#t "#editor.switch_editor_html"}}HTML Editor{{/t}}
            </a>
            <a href="#" class="rte_switch_views_link" style="display:none;">
              {{#t "#editor.switch_editor_rich_text"}}Rich Content Editor{{/t}}
            </a>
          </div>
          <div style="clear:both;"></div>
          <textarea id="assignment_description"
            name="description"
            aria-label="{{#t "description"}}Description{{/t}}"
            {{disabledIfIncludes frozenAttributes "description"}}>
            {{convertApiUserContent description forEditing=1}}
          </textarea>
        {{/if}}
      {{/ifIncludes}}
    </div>
  {{/unless}}

  <div class="control-group">

    <div class="form-column-left no-group">
      <label for="assignment_points_possible">
        {{#t "points_possible"}}Points{{/t}}
      </label>
    </div>

    <div class="form-column-right">
      <input id="assignment_points_possible"
        name="points_possible"
        value="{{n pointsPossible}}"
        type="text"
        {{#ifAny inClosedGradingPeriod lockedItems.points}}
          readonly
        {{/ifAny}}
        {{disabledIfIncludes frozenAttributes "points_possible"}}
      />
      {{#unless lockedItems.points}}
        <div aria-live="polite" role="alert">
          <div id=point_change_warning class="alert">
            {{#t}}If you change an assignment's points possible, you must regrade any submissions.{{/t}}
           </div>
        </div>
      {{/unless}}
    </div>

  </div>


  <fieldset id="assignment_group_selector" class="control-group">
  </fieldset>

  <div id="grading_type_selector"></div>

  <div id="graded_assignment_fields"
    aria-expanded="{{not isNotGraded}}"
    style="{{hiddenIf isNotGraded}}">

    {{!--this empty div is in place to push the checkbox to the right of it--}}
    <div class="form-column-left"></div>
    <div id="omit-from-final-grade" class="form-column-right" style="margin-top: 14px;">
      <label class="checkbox">
        {{#if inClosedGradingPeriod}}
          {{checkbox "omitFromFinalGrade"
            id="assignment_omit_from_final_grade"
            name="omit_from_final_grade"
            readonly="readonly"
            aria-readonly="true"
          }}
        {{else}}
          {{checkbox "omitFromFinalGrade"
            id="assignment_omit_from_final_grade"
            name="omit_from_final_grade"
          }}
        {{/if}}
        {{#t}}Do not count this assignment towards the final grade{{/t}}
      </label>
    </div>

    {{>[assignments/submission_types_form]}}

    <fieldset id="similarity_detection_tools">
    </fieldset>

    {{#unless isLargeRoster}}
      <fieldset id="group_category_selector"
        class="control-group"
        style="{{hiddenIf isExternalTool}}">
      </fieldset>
    {{/unless}}

    {{#unless isLargeRoster}}
      <fieldset id="assignment_peer_reviews_fields"
        class="control-group"
        style="{{hiddenIf isExternalTool}}">
      </fieldset>
    {{/unless}}

    {{#if postToSISEnabled}}
      <fieldset>
        <div class="form-column-left">{{#t}}Sync to {{postToSISName}}{{/t}}</div>
          <div class="form-column-right" style="margin-top: 14px;">
            <label class="checkbox">
              {{checkbox "postToSIS"
                id="assignment_post_to_sis"
                name="post_to_sis"
              }}
              {{#t}}Include this assignment's grades when syncing to your school's Student Information System{{/t}}
            </label>
        </div>
      </fieldset>
    {{/if}}

    {{#unless isQuizLTIAssignment}}
      <fieldset>
        <div class="form-column-left">{{#t}}Moderated Grading{{/t}}</div>
        <div class="form-column-right" style="margin-top: 14px;">
          <label class="checkbox">
            {{checkbox "moderatedGrading"
              id="assignment_moderated_grading"
              name="moderated_grading"
            }}
            {{#t}}Allow a moderator to review multiple independent grades for selected submissions{{/t}}
          </label>
        </div>
      </fieldset>
    {{/unless}}

    {{#if anonymousInstructorAnnotationsEnabled}}
      <fieldset>
        <div class="form-column-left">{{#t}}Anonymous Instructor Annotations{{/t}}</div>
        <div class="form-column-right" style="margin-top: 14px;">
          <label class="checkbox">
            {{checkbox "anonymousInstructorAnnotations" id="assignment_anonymous_instructor_annotations" name="anonymous_instructor_annotations"}}
            {{#t}}Anonymize all annotations made by instructors on submissions for this assignment in SpeedGrader{{/t}}
          </label>
        </div>
      </fieldset>
    {{/if}}

  </div>

  {{#if canFreeze}}
    <div class="form-column-left"></div>
    <div class="form-column-right">
      <fieldset>
        <label class="checkbox" for="assignment_freeze_on_copy">
          {{checkbox "freezeOnCopy"
            id="assignment_freeze_on_copy"
            name="freeze_on_copy"}}
            {{#t "freeze_properties"}}Lock assignment properties when copied{{/t}}
        </label>
      </fieldset>
    </div>
  {{/if}}

  <div id="overrides-wrapper">
    <div class="form-column-left">
      {{#t}}Assign{{/t}}
    </div>
    <div class="overrides-column-right js-assignment-overrides overrideFormFlex">
    </div>
  </div>
</div>

{{#if conditionalReleaseServiceEnabled}}
<div id="mastery-paths-editor" style="display: none">
  <div id="conditional_release_target" />
</div>
{{/if}}

{{#if isQuizLTIAssignment}}
  <input type="hidden" name="quiz_lti" value="1" />
{{/if}}

<input type='hidden' id="secure_params" name="secure_params" value="{{secureParams}}" />

<div class="form-actions" style="padding-left: 10px;">
  <div style="float: left; min-width: 300px;">
    <label class="checkbox" style="text-align:left;" for="assignment_notify_of_update">
      {{checkbox "notifyOfUpdate"
        id="assignment_notify_of_update"
        name="notify_of_update"}}
      {{#t "notify_content_change"}}Notify users that this content has changed{{/t}}
    </label>
  </div>

  <button type="button" class="btn cancel_button">
    {{#t "#buttons.cancel"}}Cancel{{/t}}
  </button>
  {{#unless published}}
    <button type="button" class="btn btn-default save_and_publish">
      {{#t "buttons.save_and_publish"}}Save & Publish{{/t}}
    </button>
  {{/unless}}
  <button type="submit" class="btn btn-primary">
    {{#t "buttons.save"}}Save{{/t}}
  </button>

</div>
